<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<div class="container_12 clearfix"
	style="margin-left: 0px; margin-right: 0px; width: 98%"
	id="assess_body">
	<div class="tabs side grid_12">
		<h5>评价报告</h5>
		<ul class="clearfix" id="ul_tab">
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('0')>-1">
				<li title="0"><a href="javascript:void(0)" onclick="tabChangeEvent(0)">心得报告</a></li>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('1')>-1">
				<li title="1"><a href="javascript:void(0)" onclick="tabChangeEvent(1)">外训意见回馈单</a></li>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('2')>-1">
				<li title="2"><a href="javascript:void(0)" onclick="tabChangeEvent(2)">发票或收据复印件</a></li>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('3')>-1">
				<li title="3"><a href="javascript:void(0)" onclick="tabChangeEvent(3)">结业证书</a></li>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('4')>-1">
				<li title="4"><a href="javascript:void(0)" onclick="tabChangeEvent(4)">出差报告单</a></li>
			</s:if>
		</ul>
		<section id="assess_body_content">
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('0')>-1">
				<section style="display: block;" class="clearfix" title="心得报告" alt="0">
					<div class="grid_12 alpha" id="assess_list_content_0"></div>
				</section>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('1')>-1">
				<section style="display: none;" class="clearfix" title="外训意见回馈单" alt="1">
					<div class="grid_12 alpha" id="assess_list_content_1"></div>
				</section>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('2')>-1">
				<section style="display: none;" class="clearfix" title="发票或收据复印件" alt="2">
					<div class="grid_12 alpha" id="assess_list_content_2"></div>
				</section>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('3')>-1">
				<section style="display: none;" class="clearfix" title="结业证书" alt="3">
					<div class="grid_12 alpha" id="assess_list_content_3"></div>
				</section>
			</s:if>
			<s:if
				test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('4')>-1">
				<section style="display: none;" class="clearfix" title="出差报告单" alt="4">
					<div class="grid_12 alpha" id="assess_list_content_4"></div>
				</section>
			</s:if>
		</section>
	</div>
</div>

<script type="text/javascript">
	var currentPlanId = ${plan.id};
	//显示评论列表 
	$(document).ready(function(){
		<s:if test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('0')>-1">
		loadAssessContent(currentPlanId, '心得报告', 0);
		</s:if>
		<s:if test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('1')>-1">
		loadAssessContent(currentPlanId, '外训意见回馈单', 1);
		</s:if>
		<s:if test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('2')>-1">
		loadAssessContent(currentPlanId, '发票或收据复印件', 2);
		</s:if>
		<s:if test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('3')>-1">
		loadAssessContent(currentPlanId, '结业证书', 3);
		</s:if>
		<s:if test="#request.plan.outingFeedback != null && #request.plan.outingFeedback.indexOf('4')>-1">
		loadAssessContent(currentPlanId, '出差报告单', 4);
		</s:if>
		
		$("#ul_tab li a").removeClass("current");
		$("#ul_tab").find("li").each(function(i) {
			if (i == 0) {
				$(this).find("a").addClass("current");
			}
		});
		$("#assess_body_content section").attr("style", "display:none");
		$("#assess_body_content").find("section").each(function(i) {
			if (i == 0) {
				$(this).attr("style", "display:block");
			}
		});
	});

	function tabChangeEvent(idx) {
		$("#ul_tab li a").removeClass("current");
		$("#ul_tab").find("li").each(function(i) {
			if (idx == $(this).attr("title")) {
				$(this).find("a").addClass("current");
			}
		});

		var wtitle = "";
		$("#assess_body_content section").attr("style", "display:none");
		$("#assess_body_content").find("section").each(function(i) {
			if (idx == $(this).attr("alt")) {
				$(this).attr("style", "display:block");
				wtitle = $(this).attr("title");
			}
		});

		loadAssessContent(currentPlanId, wtitle, idx);
	}

	function loadAssessContent(planId, weightTitle, tabIdx) {
		var url = "/train/train_assess_outing_employee.xhtml";
		var data = {
			"planId" : planId,
			"weightTitle" : weightTitle
		};
		//refreshListContent(url, data);
		$.ajax(url, {
			type : "POST",
			//data:{"organizationId":organizationId},
			data : data,
			dataType : "html",
			cache : false,
			success : function(a) {
				var obj = $("#assess_list_content_" + tabIdx);
				obj.html("");
				obj.append(a);
			},
			complete : function() {
			}
		});
	}

	
</script>